//#warning Upgrade NOTE: unity_Scale shader variable was removed; replaced 'unity_Scale.w' with '1.0'
// Upgrade NOTE: commented out 'float4x4 _Object2World', a built-in variable
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'


Shader  "NewWaterFlow" {

	Properties
	 {
 _MainTex ("Base (RGB)", 2D) = "white" {}
 _Scroll ("Offset", Float) = 0
 _Scale ("_Scale", Float) = 0.25
 _ScrollU ("OffsetU", Float) = 0
 _ScaleU ("_ScaleU", Float) = 1
}

	

	SubShader
     {
  Name "PREPASS"
  Tags { "LIGHTMODE"="PrePassFinal" "QUEUE"="Transparent-1" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
  ZWrite Off
  Cull Off
  Blend SrcAlpha OneMinusSrcAlpha

    LOD 100
	Pass
	{
	
	

	CGPROGRAM
	#pragma vertex vert
	#pragma fragment frag
	#include "UnityCG.cginc"
    //#define Fixed3(value)  fixed3(value, value,value)
	//#define Fixed4(value)  fixed4(value, value,value,value)

	struct VertexInput {
    fixed4 vertex : POSITION;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
    //fixed2 xlv_TEXCOORD1 : TEXCOORD1;
    //fixed3 xlv_TEXCOORD2 : TEXCOORD2;
    //fixed3 xlv_TEXCOORD3 : TEXCOORD3;
    //fixed4 tangent : TANGENT;
    fixed3 normal : NORMAL;
    //fixed4 xlv_COLOR : COLOR;
	//VertexInput
	};


	struct VertexOutput {
	fixed4 pos : SV_POSITION;
    UNITY_FOG_COORDS(1)
    //fixed4 xlv_COLOR : COLOR;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
    fixed4 xlv_TEXCOORD1 : TEXCOORD1;
    fixed3 xlv_TEXCOORD2 : TEXCOORD2;
    //fixed3 xlv_TEXCOORD3 : TEXCOORD3;
    //fixed3 xlv_TEXCOORD4 : TEXCOORD4;
	//VertexOutput
	};

	

 
 
 
 //float4 _ProjectionParams;
 //float4 unity_SHAr;
 //float4 unity_SHAg;
 //float4 unity_SHAb;
 //float4 unity_SHBr;
 //float4 unity_SHBg;
 //float4 unity_SHBb;
 //float4 unity_SHC;
 
 // float4x4 _Object2World;
 ;
 float4 _MainTex_ST;
 

	

 sampler2D _MainTex;
 float _Scroll;
 float _Scale;
 float _ScrollU;
 float _ScaleU;
 sampler2D _LightBuffer;




	VertexOutput vert (VertexInput v)
	{
	VertexOutput o;
	//o.pos = UnityObjectToClipPos (v.vertex);
	//o.xlv_TEXCOORD0 = TRANSFORM_TEX(v.xlv_TEXCOORD0, _MainTex);
	
  float3 tmpvar_1;
  float4 tmpvar_2;
  tmpvar_2 = UnityObjectToClipPos( v.vertex);
  float4 o_3;
  float4 tmpvar_4;
  tmpvar_4 = (tmpvar_2 * 0.5);
  float2 tmpvar_5;
  tmpvar_5.x = tmpvar_4.x;
  tmpvar_5.y = (tmpvar_4.y * _ProjectionParams.x);
  o_3.xy = (tmpvar_5 + tmpvar_4.w);
  o_3.zw = tmpvar_2.zw;
  float3x3 tmpvar_6;
  tmpvar_6[0] = unity_ObjectToWorld[0].xyz;
  tmpvar_6[1] = unity_ObjectToWorld[1].xyz;
  tmpvar_6[2] = unity_ObjectToWorld[2].xyz;
  float4 tmpvar_7;
  tmpvar_7.w = 1.0;
  tmpvar_7.xyz = mul(tmpvar_6 , (normalize(v.normal) * 1.0));
  half3 tmpvar_8;
  half4 normal_9;
  normal_9 = tmpvar_7;
  float vC_10;
  half3 x3_11;
  half3 x2_12;
  half3 x1_13;
  float tmpvar_14;
  tmpvar_14 = dot (unity_SHAr, normal_9);
  x1_13.x = tmpvar_14;
  float tmpvar_15;
  tmpvar_15 = dot (unity_SHAg, normal_9);
  x1_13.y = tmpvar_15;
  float tmpvar_16;
  tmpvar_16 = dot (unity_SHAb, normal_9);
  x1_13.z = tmpvar_16;
  half4 tmpvar_17;
  tmpvar_17 = (normal_9.xyzz * normal_9.yzzx);
  float tmpvar_18;
  tmpvar_18 = dot (unity_SHBr, tmpvar_17);
  x2_12.x = tmpvar_18;
  float tmpvar_19;
  tmpvar_19 = dot (unity_SHBg, tmpvar_17);
  x2_12.y = tmpvar_19;
  float tmpvar_20;
  tmpvar_20 = dot (unity_SHBb, tmpvar_17);
  x2_12.z = tmpvar_20;
  half tmpvar_21;
  tmpvar_21 = ((normal_9.x * normal_9.x) - (normal_9.y * normal_9.y));
  vC_10 = tmpvar_21;
  float3 tmpvar_22;
  tmpvar_22 = (unity_SHC.xyz * vC_10);
  x3_11 = tmpvar_22;
  tmpvar_8 = ((x1_13 + x2_12) + x3_11);
  tmpvar_1 = tmpvar_8;
  o.pos = tmpvar_2;
  o.xlv_TEXCOORD0 = ((v.xlv_TEXCOORD0 * _MainTex_ST.xy) + _MainTex_ST.zw);
  o.xlv_TEXCOORD1 = o_3;
  o.xlv_TEXCOORD2 = tmpvar_1;


    UNITY_TRANSFER_FOG(o,o.vertex);
   
	return o;
	}


	fixed4 frag(VertexOutput i) : SV_Target
    {
    //fixed4 tmpvar_2 = tex2D(_MainTex, i.uv);
	
  fixed4 tmpvar_1;
  half4 c_2;
  half4 light_3;
  fixed3 tmpvar_4;
  fixed tmpvar_5;
  half4 c_6;
  float2 uv_7;
  uv_7.y = (i.xlv_TEXCOORD0.y * _Scale);
  uv_7.x = (i.xlv_TEXCOORD0.x * _ScaleU);
  uv_7.x = (uv_7.x + _ScrollU);
  uv_7.y = (uv_7.y + _Scroll);
  fixed4 tmpvar_8;
  tmpvar_8 = tex2D (_MainTex, uv_7);
	UNITY_APPLY_FOG(i.fogCoord, tmpvar_8);
  c_6 = tmpvar_8;
  half3 tmpvar_9;
  tmpvar_9 = c_6.xyz;
  tmpvar_4 = tmpvar_9;
  half tmpvar_10;
  tmpvar_10 = c_6.w;
  tmpvar_5 = tmpvar_10;
  if ((c_6.w < 0.1)) {
    discard;
  };
  fixed4 tmpvar_11;
  tmpvar_11 = tex2Dproj (_LightBuffer, i.xlv_TEXCOORD1);
  light_3 = tmpvar_11;
  half4 tmpvar_12;
  tmpvar_12 = -(log2(max (light_3, fixed4(0.001, 0.001, 0.001, 0.001))));
  light_3.w = tmpvar_12.w;
  float3 tmpvar_13;
  tmpvar_13 = (tmpvar_12.xyz + i.xlv_TEXCOORD2);
  light_3.xyz = tmpvar_13;
  fixed4 c_14;
  half3 tmpvar_15;
  tmpvar_15 = (tmpvar_4 * light_3.xyz);
  c_14.xyz = tmpvar_15;
  c_14.w = tmpvar_5;
  c_2 = c_14;
  tmpvar_1 = c_2;
   return tmpvar_1;
	}
	ENDCG
	}
  }
Fallback "Diffuse"
}

